﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Core;

namespace WpfConsole.ConsoleTest
{
    class WpfConsoleTest
    {
        [STAThread]
        static void Main(string[] args)
        {
            TestSuite suite = new TestSuite("WpfConsole Test");
            suite.Add(new VisualGridTest());
            suite.Add(new ConsoleControlTest());
            suite.Add(new MouseSelectionTest());
            SimpleListener listener = new SimpleListener();
            suite.Run(listener);
            Console.WriteLine("All Test (" + suite.CountTestCases() + ") Done");

        }
    }

    class SimpleListener : EventListener
    {
        #region EventListener member

        public void RunFinished(Exception exception)
        {
        }

        public void RunFinished(TestResult[] results)
        {
        }

        public void RunStarted(Test[] tests)
        {
        }

        public void SuiteFinished(TestSuiteResult result)
        {
        }

        public void SuiteStarted(TestSuite suite)
        {
        }

        public void TestFinished(TestCaseResult result)
        {
            if (result.IsFailure)
            {
                Console.WriteLine("fail test!!!");
                Console.WriteLine(result.Name);
                Console.WriteLine(result.Message);
                Console.WriteLine(result.StackTrace);
            }
        }

        public void TestOutput(TestOutput testOutput)
        {
        }

        public void TestStarted(TestCase testCase)
        {
        }

        public void UnhandledException(Exception exception)
        {
            Console.WriteLine("unhandle exception!" + exception.Message);
        }

        #endregion
    }
}
